import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProDataBackupVO, ProDataBackupForm, ProDataBackupQuery } from '@/api/project/backup/types';

/**
 * 查询数据备份记录列表
 * @param query
 * @returns {*}
 */

export const listProDataBackup = (query?: ProDataBackupQuery): AxiosPromise<ProDataBackupVO[]> => {
  return request({
    url: '/pro/backup/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询数据备份记录详细
 * @param id
 */
export const getProDataBackup = (id: string | number): AxiosPromise<ProDataBackupVO> => {
  return request({
    url: '/pro/backup/' + id,
    method: 'get'
  });
};

/**
 * 新增数据备份记录
 * @param data
 */
export const addProDataBackup = (data: ProDataBackupForm) => {
  return request({
    url: '/pro/backup',
    method: 'post',
    data: data
  });
};

/**
 * 修改数据备份记录
 * @param data
 */
export const updateProDataBackup = (data: ProDataBackupForm) => {
  return request({
    url: '/pro/backup',
    method: 'put',
    data: data
  });
};

/**
 * 删除数据备份记录
 * @param id
 */
export const delProDataBackup = (id: string | number | Array<string | number>) => {
  return request({
    url: '/pro/backup/' + id,
    method: 'delete'
  });
};
